package com.train.trainmanage.conf;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.train.trainmanage.model.TrainLocoRelationModel;
import com.train.trainmanage.model.TrainModel;
import com.train.trainmanage.service.TrainService;

@Component
public class TrainJob {
	
	@Autowired
	private TrainService trainService;
	
	
	
	//   0 0 12 * * ?     每天12点执行
	//  0 0 2 * * ?     每天凌晨2点执行
	// 0/5 * * * * *    每隔5秒执行
	/*@Scheduled(cron = "0/5 * * * * *")
    public void scheduled(){
		TrainModel temTrain = new TrainModel();
		List<TrainModel> trainList = trainService.listByTrainModel(temTrain);
		if(trainList != null && trainList.size() > 0) {
			for(TrainModel tem : trainList) {
				//System.out.println(tem.toString());
			}
		}
       // System.out.println("每5秒打印一次这句话");
		int updateNum = trainService.updateTrainLocoRelaStateByJob();
		if(updateNum > 0) {
			System.out.println("---------     定时任务执行成功！！！            -----------");
		}else {
			System.out.println("---------     定时任务执行失败！！！            -----------");
		}
    }
*/
}
